package First;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Third4 {
    public class Customer {
        private String name;
        private String contact;
        private String deliveryAddress;
        private boolean active;
        private List<Order> orderList;

        public Customer(Order order, String name, String contact, String deliveryAddress) {
            this.name = name;
            this.contact = contact;
            this.deliveryAddress = deliveryAddress;
            orderList = new ArrayList<>();
        }

        public void addOrder(Order order) {
            orderList.add(order);
        }

    }

    public enum OrderStatus {
        CREATE, PAID, SHIPPING, DELIVERED, CANCEL
    }

    public class Order {
        private Date createDate;
        private OrderStatus status;
        private Customer customer;
        private List<OrderDetail> orderDetails;
        private Payment payment;


        public Order(Customer customer, Date createDate) {
            this.customer = customer;
            this.createDate = createDate;
            this.orderDetails = new ArrayList<>();
        }


        public void addOrderDetail(OrderDetail orderDetail) {
            this.orderDetails.add(orderDetail);
        }


        public void setPayment(Payment payment) {
            this.payment = payment;
        }
    }

    public class OrderDetail {
        private int quantity;
        private Product product;


        public OrderDetail(Product product, int quantity) {
            this.product = product;
            this.quantity = quantity;
        }

        public double calculateSubTotal() {
            return product.getPriceForQuantity(quantity);
        }

        public double calculateWeight() {
            return product.getWeight() * quantity;
        }
    }

    public class Product {
        private String title;
        private double weight;
        private String description;
        private int price;

        public double getPriceForQuantity(int quantity) {
            return quantity * price;
        }

        public double getWeight() {
            return weight;
        }
    }

    public class Payment {
        protected double amount;


        public Payment(double amount) {
            this.amount = amount;
        }
    }


    public class Credit extends Payment {
        private String number;
        private String type;
        private Date expireDate;

        public Credit(double amount, String number, String type, Date expireDate) {
            super(amount);
            this.number = number;
            this.type = type;
            this.expireDate = expireDate;
        }
    }

    public class Cash extends Payment {
        private double cashTendered;


        public Cash(double amount, double cashTendered) {
            super(amount);
            this.cashTendered = cashTendered;
        }
    }

    public class WireTransfer extends Payment {
        private String bankID;
        private String bankName;


        public WireTransfer(double amount, String bankID, String bankName) {
            super(amount);
            this.bankID = bankID;
            this.bankName = bankName;
        }
    }
}
